/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Army.unit;

import Army.Arrow;
import Army.BuildingAndUnit;
import Army.Bullet;
import GameObject.Sprite;
import java.awt.Point;
import java.awt.image.BufferedImage;

/**
 *
 * @author Huy
 */
public class UnitArcher extends Unit {
	public static int BUILD_TIME;
	public static int FOOD;
	public static int BUILD_COST;
	public static int[] MOVE_SEQUENCE;
	public static int[] IDLE_SEQUENCE;
	public static int[] ATTACK_SEQUENCE;
	public static int[] DIE_SEQUENCE;
	public static double MOVE_SPEED;
	public static int ATTACK_SPEED;
	public static int HEALTH_POINT;
	public static int DAMAGE;
	public static int DEFEND;
	public static int ATTACK_RANGE;
	public static int VIEW_RANGE;
	public static int SPRITE_COL;
	public static int SPRITE_ROW;
	public static Point SPRITE_MID_POINT;
	public static BufferedImage[] SPRITES;
	
	@Override
	public int[] getMoveSquence() {
		return MOVE_SEQUENCE;
	}
	@Override
	public int[] getIdleSequence() {
		return IDLE_SEQUENCE;
	}
	@Override
	public int[] getAttackSequence() {
		return ATTACK_SEQUENCE;
	}
	@Override
	public int[] getDieSequence() {
		return DIE_SEQUENCE;
	}
	
	public UnitArcher(int team, int x, int y) {
		init(team, x, y);
	}

	public UnitArcher(int team) {
		init(team, 0, 0);
	}

	private void init(int team, int x, int y) {
		attackFrame = ATTACK_SPEED;
		buildCost = BUILD_COST;
		food = FOOD;
        viewRange = VIEW_RANGE;
		attackRange = ATTACK_RANGE;
		armorScore = DEFEND;
		damgeScore = DAMAGE;
		speed = MOVE_SPEED;
		healthPoint = maxHealthPoint = HEALTH_POINT;
		sprite = new Sprite(SPRITES[team], SPRITE_COL,SPRITE_ROW, x, y);
		sprite.setInnerPoint(SPRITE_MID_POINT);
		
		type = Type.UnitArcher;
		this.team = team;
		size = 26;
		
		idle();
	}


	/*@Override
	public boolean isFired() {
		return sprite.getFrame() == 12;
	}*/
	@Override
	public Bullet getBullet() {
		return  new Arrow(team,getPosition(),getRotation(),damgeScore, 15, 2 * attackRange);
	}
	@Override
	public BuildingAndUnit create(int team, int x, int y) {
		return new UnitArcher(team, x, y);
	}

}
